#ifndef __ABSTRACT_CONTEXT_H__
#define __ABSTRACT_CONTEXT_H__

#include <DataUnit.h>
#include <vector>

using dataunits::DataUnit;

namespace contexts {


class AbstractContext;


class ContextUnit {
protected:
	DataUnit* dataUnit;
	AbstractContext* ownerContext;
	unsigned int frequency;
public:
	ContextUnit(DataUnit& dataUnit, AbstractContext& ownerContext);
	DataUnit& getDataUnit();
	void updateFrequency();
	unsigned int getFrequency();
	AbstractContext& getOwnerContext();
	virtual ~ContextUnit();
};


class AbstractContext {
public:
	AbstractContext() {};
	virtual unsigned int getTotalFrequency() =0;
	virtual vector<ContextUnit*>& getUnits() =0;
	virtual ContextUnit& getContextUnitFor(DataUnit& dataUnit) =0;
	virtual ContextUnit& getEscape() =0;
	virtual ~AbstractContext() {};
};


}
#endif //__ABSTRACT_CONTEXT_H__
